import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
import About from '../components/About'
import Home from '../components/Home'
import Message from '../components/Message'
import News from '../components/News'
import Detail from '../components/Detail'
export default new VueRouter({
    routes:[
        {
            path:'/about',
            component:About
        },
        {
            path:'/home',
            component:Home,
            children:[
                {
                    path:'message',
                    component:Message,
                    children:[
                        {
                            name:'xiangqing',
                            path:'detail/:id/:title',
                            component:Detail,

                            // 传参方式字符串的方式
                            // props:true

                            // 传参方式  对象的方式
                            // props:{
                            //     id:'11111',
                            //     title:'dfghj'
                            // }

                            // 函数的方式传参 
                            // 简写形式  加括号是把里面包含大括号的所有的当成一个函数
                             props:route=>({...route.params})
                        }
                    ]
                },
                {
                    path:'news',
                    component:News
                }
            ]

        }
    ]
})